package cn.edu.lit.jsjxy.CourseExample.chapter2;

import android.app.ListActivity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import cn.edu.lit.jsjxy.CourseExample.R;

public class ListViewTestActivity extends ListActivity
{

    ListView listView;
    String[] items;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list_view_test);

        listView = findViewById(R.id.lv1);
        //listView = getListView();


        View headerView = new View(this);
        View footerView = new View(this);

        headerView.setBackgroundColor(Color.RED);
        footerView.setBackgroundColor(Color.RED);

        headerView.setMinimumHeight(10);
        footerView.setMinimumHeight(10);

        listView.addHeaderView(headerView);
        listView.addFooterView(footerView);


        //        items = initData();
        //
        //        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
        //                android.R.id.text1, items);
        //
        //        //listView.setAdapter(adapter);
        //        setListAdapter(adapter);

        //        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        //            @Override
        //            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        //                TextView tv = (TextView) view;
        //                Toast.makeText(ListViewTestActivity.this, tv.getText(), Toast.LENGTH_SHORT).show();
        //
        //            }
        //        });
    }

    //    public String[] initData() {
    //        Resources res = getResources();
    //        String[] data = res.getStringArray(R.array.listItems);
    //        return data;
    //
    //    }
}
